package org.jivesoftware.smack.compression;

import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class JzlibInputOutputStream extends XMPPInputOutputStream
{
  private static Class<?> zoClass = null;
  private static Class<?> ziClass = null;

  static
  {
    try
    {
      zoClass = Class.forName("com.jcraft.jzlib.ZOutputStream");
      ziClass = Class.forName("com.jcraft.jzlib.ZInputStream");
    }
    catch (ClassNotFoundException localClassNotFoundException)
    {
    }
  }

  public JzlibInputOutputStream()
  {
    this.compressionMethod = "zlib";
  }

  public boolean isSupported()
  {
    return (zoClass != null) && (ziClass != null);
  }

  public InputStream getInputStream(InputStream paramInputStream)
    throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, InstantiationException
  {
    Constructor localConstructor = ziClass.getConstructor(new Class[] { InputStream.class });
    Object localObject = localConstructor.newInstance(new Object[] { paramInputStream });
    Method localMethod = ziClass.getMethod("setFlushMode", new Class[] { Integer.TYPE });
    localMethod.invoke(localObject, new Object[] { Integer.valueOf(2) });
    return (InputStream)localObject;
  }

  public OutputStream getOutputStream(OutputStream paramOutputStream)
    throws SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException
  {
    Constructor localConstructor = zoClass.getConstructor(new Class[] { OutputStream.class, Integer.TYPE });
    Object localObject = localConstructor.newInstance(new Object[] { paramOutputStream, Integer.valueOf(9) });
    Method localMethod = zoClass.getMethod("setFlushMode", new Class[] { Integer.TYPE });
    localMethod.invoke(localObject, new Object[] { Integer.valueOf(2) });
    return (OutputStream)localObject;
  }
}

/* Location:           D:\hygieia\userclient\common\libs\easemobchat_2.1.8.jar
 * Qualified Name:     org.jivesoftware.smack.compression.JzlibInputOutputStream
 * JD-Core Version:    0.6.1
 */